#include <iostream>
#include <cstring>
#include <vector>
using namespace std;

const int N = 100010;
vector<vector<int>> edges;
int n, m;
int color[N];

bool dfs(int x, int c)
{
	color[x] = c;

	for (int i = 0; i < edges[x].size(); ++i)
	{
		int newx = edges[x][i];
		if (!color[newx])
		{
			if (!dfs(newx, 3 - c))
			{
				return false;
			}
		}
		else if (color[newx] == color[x])
		{
			return false;
		}
	}
	return true;
}

int main()
{
	cin >> n >> m;
	edges.resize(n + 1);

	while (m--)
	{
		int u, v; cin >> u >> v;
		edges[u].push_back(v);
		edges[v].push_back(u);
	}

	bool flag = true;

	for (int i = 1; i <= n; ++i)
	{
		if (!color[i])
		{
			if (!dfs(i, 1))
			{
				flag = false;
				break;
			}
		}
	}

	if (flag == false)
		puts("No");
	else
		puts("Yes");

	return 0;
}